/**
 * 组件
 * @author luguoxiang
 * @date 2025-05-03
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { BaseEntity, IConfigSchema, LgBizSelect, LgBizSelectProps } from '@/soar';
import { basePath } from './api';
import { MenuComponent } from '@/types/interface';
import permitApi from '@/pages/system/auth/permit/api';

export interface Component extends BaseEntity {
  /**  */
  id?: any;
  /** 父id(0表示最顶级) */
  parentId?: any;
  /** 权限码 */
  code?: any;
  /** 组件名称 */
  name?: any;
  /** 组件路径 */
  path?: any;
  /** 所需权限ids */
  permitIds?: any;
  /** 更新人 */
  updateBy?: any;
  /** 修改时间 */
  updateTime?: any;
  /** 创建人 */
  createBy?: any;
  /** 创建时间 */
  createTime?: any;
}

const fieldList: IConfigSchema<Component>[] = [
  {
    field: 'name',
    label: '组件名称',
    dataType: 'string',
    form: {
      rules: true,
    },
    table: {
      width: 160,
    },
  },
  {
    field: 'path',
    label: '组件路径',
    dataType: 'string',
    form: {
      rules: true,
      slots: 'path',
    },
    table: {
      width: 300,
    },
  },
  {
    field: 'code',
    label: '权限码',
    dataType: 'string',
    form: {
      rules: true,
      slots: 'code',
    },
    table: {
      width: 300,
    },
  },
  {
    field: 'permitIds',
    label: '所需权限ids',
    dataType: 'string',
    table: {
      colKey: 'permits',
    },
    form: {
      slots: 'permitIds',
    },
  },
];

export default fieldList;

/**
 * 组件配置（用于生成菜单数据）
 */
/*
export const COMPONENTS: MenuComponent[] = [
  {
    title: '页面组件',
    component: () => import('./List.vue'),
    sort: 80,
    permits: [`GET${basePath}/query`],
    elements: [
      { title: '新增', code: 'create', permits: [`POST${basePath}/create`] },
      { title: '更新', code: 'update', permits: [`POST${basePath}/update`, `GET${basePath}/detail`] },
      { title: '删除', code: 'remove', permits: [`POST${basePath}/remove`] },
      { title: '详情', code: 'detail', permits: [`GET${basePath}/detail`] },
      { title: '导入', code: 'import', permits: [`POST${basePath}/import`] },
      { title: '导出', code: 'export', permits: [`GET${basePath}/export`] },
      { title: '清除缓存', code: 'clear-cache', permits: [`POST${basePath}/clear-cache`] },
      { title: '扫描', code: 'scan', permits: [`POST${basePath}/batchCreate`] },
    ],
  },
];
*/
